package DataStr.homework02.h2;

import java.util.Stack;

public class ex03 {
    public void isreaser(String a){
         char[]temp=new char[a.length()];
         for(int i=0;i<a.length();i++){
             temp[i]=a.charAt(i);
         }
        //将字符串推入stack2栈
        Stack<Character> stack2=new Stack<>();
            for (int i=0;i<temp.length;i++) {
                stack2.push(temp[i]);
            }
        System.out.println("原来整数栈");
            for(int i=0;i<temp.length;i++){
                System.out.print(temp[i]);
            }
        System.out.println("");
        System.out.println("反转后的整数栈");
        while(!stack2.isEmpty()){
            System.out.print(stack2.pop());
        }
    }
    public static void main(String[]args){
        String a="123456789";
        ex03 e=new ex03();
        e.isreaser(a);
    }
}
